import request from "@/utils/request";

export function getOrders(paramters) {
  return request({
    url: "api/v1/purchases/orders",
    method: "get",
    params: paramters,
    businessServer: true,
  });
}

export function getOrder(id) {
  return request({
    url: "api/v1/purchases/orders/" + id,
    method: "get",
    businessServer: true,
  });
}

export function addOrder(data) {
  return request({
    url: "api/v1/purchases/orders",
    method: "post",
    data: data,
    businessServer: true,
  });
}

export function updateOrder(data) {
  return request({
    url: "api/v1/purchases/orders",
    method: "put",
    data: data,
    businessServer: true,
  });
}

export function updateOrderStatus(id, status) {
  return request({
    url: "api/v1/purchases/orders/" + id + "/status/" + status,
    method: "put",
    data: {},
    businessServer: true,
  });
}

export function deleteOrder(id) {
  return request({
    url: "api/v1/purchases/orders/" + id,
    method: "delete",
    businessServer: true,
  });
}

export function pushReceipt(id) {
  return request({
    url: "api/v1/purchases/orders/" + id+"/receipt",
    method: "post",
    businessServer: true,
  });
}

export function pushPaymentRequisition(id) {
  return request({
    url: "api/v1/purchases/orders/" + id+"/payment-requisitions",
    method: "post",
    businessServer: true,
  });
}